﻿<Page
    x:Class="SimpleRssReader.PostPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SimpleRssReader"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls="using:Windows8Accelerator.Core.Xaml.Controls"
    xmlns:Converters="using:Windows8Accelerator.Core.Xaml.Converters"
    mc:Ignorable="d">

    <Page.Resources>
        <CollectionViewSource
            x:Name="blogsViewSource"
            Source="{Binding Blogs}"
            IsSourceGrouped="true"
            ItemsPath="Posts"/>
    </Page.Resources>

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Controls:SuperSilhouette HeaderSource="{Binding Post.Blog.Name}">
            <Controls:SuperSilhouette.SnappedProperties>
                <Controls:PropertySetters>
                    <Controls:PropertySetter Target="Grid" Property="Margin" Value="17,0,17,57" />
                    <Controls:PropertySetter Target="scrollViewer" Property="Style" Value="{StaticResource VerticalScrollViewerStyle}" />
                    <Controls:PropertySetter Target="SuperListView" Property="Visibility" Value="Collapsed" />
                    <Controls:PropertySetter Target="SuperRichTextBlock" Property="ColumnWidth" Value="280" />
                </Controls:PropertySetters>
            </Controls:SuperSilhouette.SnappedProperties>

            <Grid>
                <ScrollViewer x:Name="scrollViewer" Style="{StaticResource HorizontalScrollViewerStyle}">
                    <Grid x:Name="Grid" Margin="117,0,0,47">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnText" Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Controls:SuperRichTextBlock
                            x:Name="SuperRichTextBlock"
                            ColumnWidth="560"
                            DataContext="{Binding Post}" 
                            HtmlSource="{Binding Body}"
                            VerticalAlignment="Top"                            
                            >
                            <Paragraph LineStackingStrategy="MaxHeight">
                                <Run FontSize="26.667" FontWeight="Light" Text="{Binding Title}"/>
                            </Paragraph>
                            <Paragraph  TextAlignment="Right" LineStackingStrategy="MaxHeight">
                                <InlineUIContainer>
                                    <Button Margin="0,20,0,10" Content="Open in Browser" Tag="{Binding Url}" Click="BrowserButtonClick" />
                                </InlineUIContainer>
                            </Paragraph>
                            <Paragraph LineStackingStrategy="MaxHeight">
                                <LineBreak/>
                            </Paragraph>
                        </Controls:SuperRichTextBlock>
                        <Controls:SuperListView 
                            x:Name="SuperListView" Grid.Column="1"
                            ItemsSource="{Binding Source={StaticResource blogsViewSource}}"
                            SelectionMode="None"
                                                    
                            FullScreenLandscapeItemWidthString="250"
                            FullScreenLandscapeItemHeightString="250"
                            FullScreenLandscapeGroupMarginString="0,0,20,0"
                            FullScreenLandscapeGroupHeaderTemplate="{StaticResource BlogHeaderTemplate}"
                            FullScreenLandscapeItemTemplate="{StaticResource PostTemplate}"
                            FullScreenLandscapePanelMarginString="80,0,0,0"
                        />
                    </Grid>
                </ScrollViewer>
            </Grid>
        </Controls:SuperSilhouette>
    </Grid>
</Page>